<%-- 
    Document   : confirm
    Created on : Jun 3, 2011, 9:36:39 AM
    Author     : MongKieu
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%! HashMap nvp;
%>
<%
            /*==================================================================
            PayPal Express Checkout Call
            ===================================================================
             */
            String token = session.getAttribute("TOKEN").toString();
            if (token != null) {
%>
<%@include file="paypalfunctions.jsp" %>
<%
                /*
                '------------------------------------
                ' Get the token parameter value stored in the session
                ' from the previous SetExpressCheckout call
                '------------------------------------
                 */
                //String token =  session.getAttribute("TOKEN")toString();

                /*
                '------------------------------------
                ' The paymentAmount is the total value of
                ' the shopping cart, that was set
                ' earlier in a session variable
                ' by the shopping cart page
                '------------------------------------
                 */

                String finalPaymentAmount = session.getAttribute("Payment_Amount").toString();

                /*
                '------------------------------------
                ' Calls the DoExpressCheckoutPayment API call
                '
                ' The ConfirmPayment function is defined in the file PayPalFunctions.jsp,
                ' that is included at the top of this file.
                '-------------------------------------------------
                 */

                nvp = ConfirmPayment(finalPaymentAmount, session, request);
                String strAck = nvp.get("ACK").toString();

            }

%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Confirm</h1>
        <%if (nvp.get("ACK").toString().equals("Success")) {

        %>
        <b>Giao dich với paypal thành công</b>

        <%
                        session.removeAttribute("Payment_Amount");
                    }

        %>

    </body>
</html>
